package com.ssy.lingxi.product.service;

import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.product.api.model.request.warehouse.*;
import com.ssy.lingxi.product.api.model.response.warehouse.*;

import java.util.List;

/**
* 仓位库存管理
* @author wrc
* @date 2020/6/28
*/
public interface FreightSpaceService {


    /**
    * 仓位库存列表查询
    * @author wrc
    * @date 2020/6/28
    */
    Wrapper<PageData<FreightSpaceListResponse>> freightSpaceList(FreightSpaceListRequest request, UserLoginCacheDTO sysUser);


    /**
    * 停用&启用仓位库存管理
    * @author wrc
    * @date 2020/6/28
    */
    Wrapper freightSpaceStopRoStart(FreightSpaceStopRoStartRequest request, UserLoginCacheDTO sysUser);

    /**
    * 新增仓位库存
    * @author wrc
    * @date 2020/6/29
    */
    Wrapper freightSpaceAdd(FreightSpaceAddRequest request, UserLoginCacheDTO sysUser);

    /**
     * 批量新增仓位库存
     * @author jw.chen
     * @date 2021/5/11
     */
    Wrapper freightSpaceAddBatch(FreightSpaceAddBatchRequest request, UserLoginCacheDTO sysUser);

    /**
    * 仓位库存详情查询
    * @author wrc
    * @date 2020/7/8
    */
    Wrapper<FreightSpaceDetailsResponse> freightSpaceDetails(FreightSpaceDetailsRequest request, UserLoginCacheDTO sysUser);

    /**
    * 修改仓位信息
    * @author wrc
    * @date 2020/7/9
    */
    Wrapper freightSpaceUpdatat(FreightSpaceUpdataRequest request, UserLoginCacheDTO sysUser);

    /**
     * 仓位库存信息批量修改
     * @param request
     * @param sysUser
     * @return
     */
    Wrapper freightSpaceUpdateBatch(FreightSpaceUpdateBatchRequest request, UserLoginCacheDTO sysUser);

    /**
    * 仓位库存调拨-调出
    * @author wrc
    * @date 2020/7/9
    */
    Wrapper<FreightSpaceAllotFoldResponse> freightSpaceAllotExport(FreightSpaceAllotRequest request, UserLoginCacheDTO sysUser);

    /**
     * 仓位库存调拨-调入
     * @author wrc
     * @date 2020/7/9
     */
    Wrapper<FreightSpaceAllotFoldResponse> freightSpaceAllotFold(FreightSpaceAllotRequest request, UserLoginCacheDTO sysUser);

    /**
    * 根据商品ID查询仓位库存
    * @author wrc
    * @date 2020/7/9
    */
    Wrapper<List<FreightSpaceProductIdListResponse>> freightSpaceByProductId(FreightSpaceProductIdListRequest request, UserLoginCacheDTO sysUser);

    /**
    * 查询全部仓位
    * @author wrc
    * @date 2020/8/7
    */
    Wrapper<List<FreightSpaceListResponse>> freightSpaceAll();

    /**
    * 查询仓位调拨记录ID
    * @author wrc
    * @date 2020/8/14
    */
    Wrapper<PageData<FreightSpaceAllotLogListResponse>> freightSpaceAllotFoldLog(FreightSpaceAllotLogListRequest request);

    /**
    * 根据仓位ID查询仓位绑定的会员
    * @author wrc
    * @date 2020/9/18
    */
    Wrapper<PageData<ApplyMemberRequest>> freightSpaceMamberList(FreightSpaceAllotLogListRequest request);

    /**
    * 扣除商品库存
    * @author wrc
    * @date 2020/9/8
    */
    Wrapper<Void>  deductInventory(InventoryByProductIdRequest  request);

    /**
    * 返回库存
    * @author wrc
    * @date 2020/9/16
    */
    Wrapper<Void>  deductReturn(InventoryByProductIdRequest  request);

    /**
    * 根据商品ID查询仓位扣减记录
    * @author wrc
    * @date 2020/9/24
    */
    Wrapper<PageData<PositionInventoryDeductionRecordResponse>>  positionDeductionRecordList(UserLoginCacheDTO sysUser ,PositionInventoryDeductionRecordRequest  request);

    /**
     * 根据商品ID查询仓位扣减记录- 平台后台
     */
    Wrapper<PageData<PositionInventoryDeductionRecordResponse>>  platformPositionDeductionRecordList(UserLoginCacheDTO sysUser ,PositionInventoryDeductionRecordRequest  request);

    /**
     *查询商品的仓位库存
     */
    Wrapper<Double>  stockByProductId(StockByProductIdRequest  request,UserLoginCacheDTO sysUser);

    /**
     *查询商品的仓位库存
     */
    Wrapper<Double>  stockByProductIdInside(Long productId,Long shopId,Long memberId,Long memberRoleId);

    /**
     *批量查询商品的仓位库存-内部
     */
    Wrapper<List<StockByProductIdsResponse>>   stockByProductIdInsides(StockByProductIdsRequest request);

    /**
     *筛选适用会员角色为服务消费者的商品SKU
     */
    Wrapper<List<Long>>  stockByProductIdInsides(List<Long> skuIds, Long memberId, Long memberRoleId);

    /**
     * redis库存初始化
     */
    void syncFreightSpace();

    /**
     * 仓位库存列表修改库存
     * @param request 参数
     */
    Boolean updateInventory(FreightSpaceUpdateInventoryRequest request, UserLoginCacheDTO sysUser);
}
